﻿#ifndef __AVOID_BW_CONTORL_STATIC_HEAD_FILE_INCLUDED__
#define __AVOID_BW_CONTORL_STATIC_HEAD_FILE_INCLUDED__
#include "control.h"
#include "interface/IDrag.h"
#include "interface/IUserDraw.h"
#include "interface/IBackground.h"

namespace swui
{
#pragma warning(push)
#pragma warning(disable:4250)
	class ctlStatic : virtual public ctlRoot, 
		public IDrag, public IBackground, public IUserDraw
	{
		friend ctlRoot* ctlRoot::init(ctlInitInfo*);
	public:
		static const ctlControlType uniqueType = ctlControlType::ctlStatic;
	public:
		ctlStatic() { _isRoot = false; }
		virtual ~ctlStatic() { destroy(); }
		bool create(ctlRoot* parent, ctlRect rect);
	public:
		// 若 isNotify() 为 true，则允许 Static 控件接受消息
		void setNotify(bool isNotify);
		bool isNotify();
	protected:
		virtual void _redraw_(_ctlInterior::drawInfo*);
		virtual bool _judge_point_(ctlPoint);
	private:
		bool _isRoot, _isNotify;
	};
#pragma warning(pop)

	inline bool ctlStatic::isNotify() {
		return _isNotify;
	}

	inline void ctlStatic::setNotify(bool n) {
		_isNotify = n;
	}

	inline bool ctlStatic::create(ctlRoot* parent, ctlRect rect)
	{
		if(parent == 0 && !_isRoot || isCreated() || parent && !parent->isCreated()) return false; 
		_control_virtual_class_end = this;
		_basic_create_(rect, parent);
		_controlType = ctlControlType::ctlStatic;
		setNotify(false);
		redraw();
		return true;
	}
}

#endif